
const date = new Date()

//昨天的时间
var day1 = new Date();
day1.setTime(day1.getTime() - 24 * 60 * 60 * 1000);
var day1_month = day1.getMonth() + 1;
if(day1_month < 10) {
    day1_month = "0"+day1_month;
}
var day1_date = day1.getDate();
if(day1_date < 10) {
    day1_date = "0"+day1_date;
}
var s1 = day1.getFullYear() + "-" + day1_month + "-" + day1_date;
//今天的时间
var day2 = new Date();
day2.setTime(day2.getTime());
var day2_month = day2.getMonth() + 1;
if(day2_month < 10) {
    day2_month = "0"+day2_month;
}
var day2_date = day2.getDate();
if(day2_date < 10) {
    day2_date = "0"+day2_date;
}
var s2 = day2.getFullYear() + "-" + day2_month + "-" + day2_date;
// var s2 = day2.getFullYear() + "-" + (day2.getMonth() + 1) + "-" + day2.getDate();
//明天的时间
var day3 = new Date();
day3.setTime(day3.getTime() + 24 * 60 * 60 * 1000);
var day3_month = day3.getMonth() + 1;
if(day3_month < 10) {
    day3_month = "0"+day3_month;
}
var day3_date = day3.getDate();
if(day3_date < 10) {
    day3_date = "0"+day3_date;
}
var s3 = day3.getFullYear() + "-" + day3_month + "-" + day3_date;
// var s3 = day3.getFullYear() + "-" + (day3.getMonth() + 1) + "-" + day3.getDate();


// 时间段数组
var timeArray =[{"name": "08:00"},
        {"name": "09:00"},
        {"name": "10:00"},
        {"name": "11:00"},
        {"name": "12:00"},
        {"name": "13:00"},
        {"name": "14:00"},
        {"name": "15:00"},
        {"name": "16:00"},
        {"name": "17:00"},
        {"name": "18:00"},
        {"name": "19:00"},
        {"name": "20:00"}]

var timeData = [{
    "name": s1,
    "time": timeArray
},
{
    "name": s2,
    "time": timeArray
}, {
    "name": s3,
    "time": timeArray
}
];

function init(that) {
    that.setData({
        'timeData': timeData
    });
}

module.exports = {
    init: init
}

